package com.course.controller;

import com.baselib.android.utils.Logger;
import com.course.utils.web.HttpAction;
import com.course.utils.web.HttpReq;
import com.course.utils.web.HttpRespCallBack;
import com.course.utils.web.MapBuilder;

public class NewsController {
    static NewsController instance;

    public static NewsController getInstance() {
        if (instance == null) {
            instance = new NewsController();
        }
        return instance;
    }

    public void query(HttpRespCallBack httpRespCallBack,String category,int pageNum,int pageSize){
        Logger.d("initData1");
        HttpReq.getInstance().post(HttpAction.newsQuery.getValue(),
                new MapBuilder<String, Object>()
                        .add("category",category)
                        .add("pageNum",pageNum)
                        .add("pageSize",pageSize)
                        .getMap(),
                httpRespCallBack);

    }
    public void query(HttpRespCallBack httpRespCallBack,String category,String type,int pageNum,int pageSize){
        HttpReq.getInstance().post(HttpAction.newsQuery.getValue(),
                new MapBuilder<String, Object>()
                        .add("type",type)
                        .add("category",category)
                        .add("pageNum",pageNum)
                        .add("pageSize",pageSize)
                        .getMap(),
                httpRespCallBack);

    }


    public void videoUpload(HttpRespCallBack httpRespCallBack,String video,String img){
        HttpReq.getInstance().post(HttpAction.newVideoUpload.getValue(),
                new MapBuilder<String, Object>()
                        .add("video",video)
                        .add("img",img)
                        .getMap(),
                httpRespCallBack);

    }

}
